<template>
	<view>
		<u-popup :show="!issg" mode="center" round="30rpx">
			<view class="popbox">
				分享小程序到朋友圈
				<view class="" style="height: 50rpx;">
					
				</view>
				<u-button text="已分享" @click="clickbtn" color="#0383fc" shape='circle'></u-button>
			</view>
			
		</u-popup>
	</view>
</template>

<script>
	import home from '@/api/_home.js'
	export default {
		data() {
			return {
				issg:true
			};
		},
		onLoad() {
			home.indexcode().then(res=>{
				if(res.data.code==1){
					this.issg=false
				}
				if(res.data.code==0){
					this.issg=true
					uni.$u.toast('您已扫过该二维码')
					
					setTimeout(()=>{
						uni.switchTab({
							url:'/pages/tabbar/home'
						})
					},1000)
					
				}
			})
		},
		methods:{
			clickbtn(){
				home.createcodeUse().then(res=>{
					if(res.data.code==1){
						uni.switchTab({
							url:'/pages/tabbar/home'
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
.popbox{
	width: 500rpx;
	padding: 50rpx;
	// background-color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	.btn{
		padding-top: 50rpx;
	}
}
</style>
